import type {Router} from 'vue-router';


export async function createTenantGuard(router: Router) {
  router.beforeEach(async (to, from, next) => {
    console.log("from:", from.path, "to: ", to.path, ", tenantId", to.params);
    if (!to.params.tenantId) {
      let toParams = JSON.parse(JSON.stringify(to.params));
      toParams.tenantId = 1;
      // next({
      //   name: to.path,
      //   query: from.query,
      //   params: toParams
      // })
    } else {
      // next()
    }
    next()
  });
}
